notifications: announcement channel selector + proper re-engagement emails#55
Merged
Merged
Conversation
…nd-notification
Lets callers choose whether an announcement fires email only, push only,
or both. Adds a `notificationTypes` request field ("email" | "push" |
"both") validated at the endpoint and persisted on the notification row's
`data.notification_channels`. The Announcement mapper reads it and gates
the push/email broadcasts accordingly.
Defaults to "both" when omitted (and for pre-existing rows), so existing
callers are unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Announcement emails (incl. re-engagement campaigns sent by the notifications-dashboard cron via /internal/send-notification) reused the generic unread-notification email shell and discarded almost all campaign data: the heading, CTA deep-link, and artwork were dropped, and the subject was always "N unread notifications on Audius". These rows are the same `announcement` notification type as one-off announcements, and the cron passes the same fields (title/body/route/ image_url), so the fix is on the email-rendering side: - getTitle() now renders data.title as the heading for announcements - WrapLink uses the notification's `route` to build an absolute audius.co deep-link instead of the hardcoded /feed link - the announcement body now renders image_url as campaign artwork - single-announcement emails use the heading as the subject line All fields are optional; rows without them fall back to the previous behavior (no heading/image, feed link, generic subject). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes that make
/internal/send-notificationannouncements (including the re-engagement / inactivity campaigns the notifications-dashboard cron sends) deliver good emails, not just push:c274d84):/internal/send-notificationaccepts an optionalnotificationTypesofemail|push|both, stored asnotification_channelson the announcement row and honored by the mapper. Defaults tobothfor back-compat.91cbb9f): announcement emails previously reused the generic unread-notification shell and discarded the campaign's heading, CTA link, and artwork — the subject was always "N unread notifications on Audius".Context
Re-engagement notifications are the same
announcementnotification type as one-off announcements (the cron insertstype: 'announcement'via the endpoint; the mapper dispatches ontype == 'announcement'). The dashboard'ssend-reengagementcron passes the same fields a regular announcement does —title(heading),body,route(CTA),image_url— but the email side dropped all but the body.Email fixes (all 5)
getTitle()now rendersdata.titlefor announcements (was hardcodednull).WrapLinkbuilds an absoluteaudius.codeep-link from the notification'srouteinstead of the hardcoded/feed?openNotifications=true.image_url.Testing
tsc --noEmitclean forapps/notifications/src(pre-existing@types/babel__traversenode_modules errors are unrelated).🤖 Generated with Claude Code